/* enum */
import ComponentNameEnum from '@model/enum/ComponentNameEnum'
/* scss */
import '@src/component/common/BaseUserLabel/index.scss'
/* vue */
// @ts-ignore
import { ComponentInstance, ComponentRenderProxy, defineComponent, PropType } from 'vue'
import { CommonComponentInstance } from '@model/VC'
import { CreateElement } from 'vue'

export type BaseUserLabelProps = {
  tooltip: string;
  value: string;
}

export interface BaseUserLabelSetupState {
  
}

export enum BaseUserLabelEmitEventNameEnum {
  Input = 'input',
}

export type BaseUserLabelInstance = ComponentInstance & BaseUserLabelSetupState
export type BaseUserLabelVM = ComponentRenderProxy<BaseUserLabelProps> & CommonComponentInstance & BaseUserLabelInstance

export default defineComponent({
  name: ComponentNameEnum.BaseUserLabel,
  emits: [
    BaseUserLabelEmitEventNameEnum.Input
  ],
  props: {
    tooltip: {
      type: String as PropType<string>,
      default: ''
    },
    value: {
      type: String as PropType<string>,
      default: '',
      required: true
    }
  },
  setup(props: BaseUserLabelProps, { emit }) {
    
  },
  render(h: CreateElement) {
    
    const content = (
      <div class={ComponentNameEnum.BaseUserLabel}>
        { this.value }
      </div>
    )
    
    if (this.tooltip) {
      return (
        <el-tooltip content={this.tooltip} placement="top" popper-class="base-user-label-tooltip-popper">
          { content }
        </el-tooltip>
      )
    }
    
    return content
  }
})
